class LPF_Fst:
    def __init__(self):
        ## private
        self._alpha = 0.0
        self._dataOld = 0.0
        self._isIni = False
        
    ## public c++ func
    def LPF_Fst(self):
        self._alpha = 0
    
    def LPF_Fst(self, fc, Ts):
        self._alpha = Ts / (Ts + 1.0 / (2 * 3.1415 * fc))
        
    def setPara(self, fc, Ts):
        self._alpha = Ts / (Ts + 1.0/(2 * 3.1415 * fc))
        
    def ftOut(self, dataIn):
        res = 0.0
        if self._isIni:
            res = (1 -  self._alpha) *  self._dataOld +  self._alpha * dataIn
        else:
            res=dataIn
            self._isIni = True
        self._dataOld=res
        return res
        
